package com.cyf.db.mapper;

import com.cyf.db.bean.RegSms;
import org.apache.ibatis.annotations.*;

import java.util.Date;

/**
 * app的短信验证码发送记录
 * Created by cage on 2017/2/16.
 */

public interface RegSmsMapper {

    @Insert("insert into regsms(mobile, smsTime, code) values(#{appRegSms.mobile}, #{appRegSms.smsTime}, #{appRegSms.code})")
    void insertRegSms(@Param("appRegSms") RegSms regSms);

    @Select("select * from regsms where mobile = #{mobile}")
    RegSms getByMobile(@Param("mobile") String mobile);

    @Delete("delete from regsms where id = #{id}")
    void deleteById(@Param("id") Integer id);

    @Delete("delete from regsms where smstime < #{timeout}")
    int deleteTimeout(@Param("timeout") Date timeout);

    @Delete("delete from regsms where mobile = #{mobile}")
    void deleteByMobile(@Param("mobile") String mobile);
}
